package com.huawei.hms.support.api.sns.json;

import android.text.TextUtils;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.internal.ResponseErrorCode;
import com.huawei.hms.common.internal.TaskApiCall;
import com.huawei.hms.core.aidl.IMessageEntity;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.sns.internal.UserDataResp;
import com.huawei.hms.support.api.sns.json.SnsClient.Callback;
import com.huawei.hms.utils.JsonUtil;
import o.fjx;

public class SnsGetUserDataApiCall extends TaskApiCall<SnsHmsClient, UserDataResp> {
    Callback a;
    private String b;
    private SnsClientImpl c;

    public SnsGetUserDataApiCall(String str, String str2) {
        super(str, str2);
    }

    public SnsGetUserDataApiCall(String str, String str2, Callback callback, SnsClientImpl snsClientImpl) {
        super(str, str2);
        this.a = callback;
        this.c = snsClientImpl;
        this.b = str;
    }

    protected void doExecute(SnsHmsClient snsHmsClient, ResponseErrorCode responseErrorCode, String str, fjx<UserDataResp> o_fjx_com_huawei_hms_support_api_entity_sns_internal_UserDataResp) {
        this.c.biReportExit(this.b, getTransactionId(), responseErrorCode.getStatusCode(), responseErrorCode.getErrorCode());
        if (responseErrorCode.getErrorCode() != 0) {
            o_fjx_com_huawei_hms_support_api_entity_sns_internal_UserDataResp.ॱ(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason())));
            if (this.a != null) {
                this.a.notify("error " + responseErrorCode.getErrorReason());
            }
        } else if (!TextUtils.isEmpty(str)) {
            IMessageEntity jsonToEntity = JsonUtil.jsonToEntity(str, new UserDataResp());
            if (jsonToEntity instanceof UserDataResp) {
                o_fjx_com_huawei_hms_support_api_entity_sns_internal_UserDataResp.ॱ((UserDataResp) jsonToEntity);
            }
            if (this.a != null) {
                this.a.notify(str);
            }
        }
    }
}
